<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>1.offset相关</title>
		<style type="text/css">
			*{
				margin:0;
				padding:0;
			}
			.box{
				width:200px;
				height:200px;
				background:red;
				margin-top:100px;
				margin-left:130px;
				overflow: hidden;
			}
			.son{
				width:60px;
				height:60px;
				background:blue;
				margin-left:30px;
				margin-top:40px;
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="son"></div>
		</div>
		<script type="text/javascript">
			//获取元素对象
			// 情形1：相关盒子没有定位父级，那么与盒子相关的offset值和body有关系
			var box = document.querySelector('.box');
			var son = document.querySelector('.son');
			console.log('BOX的offsetLeft::'+box.offsetLeft);
			console.log('BOX的offsetTop::'+box.offsetTop);
			console.log('SON的offsetLeft::'+son.offsetLeft);
			console.log('SON的offsetTOP::'+son.offsetTop);
		</script>
	</body>
</html>
